import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    // userInfo: {},
    // userAddress: [],//用户地址
    // newAddress: {}, //新增地址
    // id: 1,
    updateAddress: {}
  },
  mutations: {
    // addUserInfo(state, payload) {
    //   console.log(payload);
    //   state.userInfo = payload;
    // },
    // // 退出用户登录
    // quitUser(state) {
    //   state.userInfo = {};
    // },
    // //保存收货地址
    // address(state, { name, tel, addressDetail, isDefault }) {
    //   // console.log(payload);
    //   state.newAddress.id = state.id++;
    //   state.newAddress.name = name;
    //   state.newAddress.tel = tel;
    //   state.newAddress.address = addressDetail;
    //   state.newAddress.isDefault = isDefault;
    //   state.userAddress.push(state.newAddress);
    //   state.newAddress = {};
    // }
    updateAddress(state, payload) {
      state.updateAddress = payload;
      state.updateAddress.addressDetail=payload.address;
    }

  },
  actions: {},
  modules: {},
});
